package com.zx.BookSeaReader.ui.home.bookcommunity;


import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.zx.BookSeaReader.R;
import com.zx.BookSeaReader.common.APPCONST;
import com.zx.BookSeaReader.greendao.entity.UserBean;
import com.zx.BookSeaReader.ui.booklistcreate.BookListCreateActivity;
import com.zx.BookSeaReader.util.TextHelper;
import com.zx.BookSeaReader.util.ToastUtils;
import com.zx.BookSeaReader.widget.itemdecoration.DividerItemDecoration;

import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;


public class BookCommunityFragment extends Fragment {
    @BindView(R.id.refresh_rv_created_list)
    RecyclerView rvCreateList;
    @BindView(R.id.refresh_rv_list)
    RecyclerView rvBookList;
    @BindView(R.id.tv_add_booklist)
    TextView tvAddBookList;
    @BindView(R.id.tv_create_booklist)
    TextView tvCreateBookList;



    private Unbinder unbinder;

    private BookCommunityPresenter mBookCommunityPresenter;


    public BookCommunityFragment() {
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_book_community, container, false);
        unbinder = ButterKnife.bind(this, view);
        //userBean = (UserBean)getActivity().getIntent().getSerializableExtra(APPCONST.USER);
        mBookCommunityPresenter = new BookCommunityPresenter(this);
        mBookCommunityPresenter.start();
        return view;

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }


    @Override
    public void onResume() {
        super.onResume();
        mBookCommunityPresenter.initAdapter();
    }
    public RecyclerView getRvCreateList() {
        return rvCreateList;
    }
    public RecyclerView getRvBookList() {
        return rvBookList;
    }
    public TextView getTvAddBookList() {
        return tvAddBookList;
    }
    public TextView getTvCreateBookList() {
        return tvCreateBookList;
    }



//    protected void initClick() {
//        rvCreateBookList.setOnClickListener(
//                (view) -> {
//                    Intent intent = new Intent(getActivity(), BookListCreateActivity.class);
//                    intent.putExtra(APPCONST.USER, userBean);
//                    getActivity().startActivity(intent);
//                }
//        );
//
//    }

}
